extends "../tashigan-3/tashigan-3.gd"


var baseId = ""
var upText1 = "火力向导持续时间+1秒"
var upText2 = "着弹侦测还会对自己生效"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("战斗开始时，为正后方的1名友军提供辅助，每{cd}秒使其下2次造成的技能伤害翻倍", "着弹侦测", "tashigan4", 6)

var bindCha = []

class b_tashigan:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var num = 2
	func _init():
		attInit()
		id = "b_tashigan"
		buffName = "着弹侦测"
		dispel = 2
	func _connect():
		masCha.connect("onAtkChara",self,"_onAtkChara")
	func _onAtkChara(atkInfo:AtkInfo):
		if atkInfo.atkType == sys.AtkType.SKILL:
			atkInfo.hurtVal *= 2
			num -= 1
		if num <= 0:
			isDel = true

func _onBattleStart():
	._onBattleStart()
	bindCha.clear()
	var cha = sys.main.matCha(cell + Vector2(-1, 0))
	if cha != null:
		bindCha.append(cha)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "tashigan4":
		tashigan4()
		
func tashigan4():
	for i in bindCha:
		if i.isDeath:continue
		utils.createSkillTextEff("着弹侦测", position)
		utils.createSkillTextEff("着弹侦测", i.position)

		var bf = i.hasBuff("b_tashigan")
		if bf == null:
			i.addBuff(b_tashigan.new())
		else:
			bf.num += 2

		if upgraded == 2:
			var bf2 = hasBuff("b_tashigan")
			if bf2 == null:
				addBuff(b_tashigan.new())
			else:
				bf2.num += 2

func upgrade():
	.upgrade()
	if upgraded == 1:
		p32 = 4